#!/usr/bin/python

import os
import wx

# --------------------------------- STAGE 1 ----------------------------------

import startup

app,configuration_dir = startup.stage1() # don't have configuration_dir here, use paths.get_configuration_dir()

# --------------------------------- STAGE 2 ----------------------------------

from base           import *
from paths          import get_user_settings_module_path, get_default_settings_dump_path,get_persistent_state_savefile_path
from plat           import if_Mac_Unix_Win
from other          import EventSet, platform_eol, figure_out_eol, WeakMethod, samefile, Gray

startup.stage2_setup_configuration_dir()

# --------------------------------- STAGE 3 ----------------------------------

import debug

import configuration

persistent_state=configuration._PersistentStateSingleton() # ?? needs shorter name

settings=configuration._GlobalSettingsSingleton()

settings.push_mode(settings.DEFAULTS_MODE)

# the following imports, among other things, populate settings with defaults
import textstyle

from modes          import DefaultMode
from textbar        import Textbar
from document       import Document
from mainframe     import reset_status_text,set_status_text,short_duration_status_text
from paranoia import safer_save
from version import VERSION, VERNUMBER, version_summary

settings.for_reference_dump_default_settings()

settings.load_user_settings(need_reload=False)

settings.push_mode(settings.USER_SET_THROUGH_GUI)
# from this point forward, all settings set will be "automatically managed"
# which means they'll be saved in a special section of the user settings file

UNCHANGED,SAVED,UNSAVED=range(3)

main_frame,main_panel = startup.stage3()

# --------------------------------- STAGE 4 ----------------------------------

def main():
	startup.stage4_main_loop()
